import request from '@/config/axios'

export function useDashboardApi() {
    return {
        // 最新预约信息
        getSubList: async (params: PageParam) => {
            return await request.get({url: '/yxt/datalook/getLastSubList',params})
        },
        // 练琴排行榜
        getSubRankList: async () => {
            return await request.get({url: '/yxt/datalook/getSubRankList'})
        },
        // 上周课程统计 + 上周练琴统计
        getLastWeekData: async () => {
            return await request.get({url: '/yxt/datalook/lastWeekData'})
        },
        // 今日预约数据 + 今日练琴动态 + 今日琴房信息
        getTodayData: async () => {
            return await request.get({url: '/yxt/datalook/todayData'})
        },
    }
}

export function useModuleApi() {
    return {
        // 学校排行榜
        getSchoolRank: async () => {
            return await request.get({url: '/yxt/template/getSchoolRank'})
        },
        // 基础数据
        getBaseCount: async () => {
            return await request.get({url: '/yxt/template/getBaseCount'})
        },
        // 院校所在地区数据
        getSchByPro: async () => {
            return await request.get({url: '/yxt/template/getSchByPro'})
        },
        // 练琴数据统计 + 课程数据统计
        getDataStats: async () => {
            return await request.get({url: '/yxt/template/getDataStats'})
        },
    }
}

//琴房一览
export function useRoomDataApi() {
    return {
        //多条件分页查询
        getListByCondition: async (data: any) => {
            return await request.post({url: '/yxt/roomlook/getListByCondition', data})
        },
        //锁定琴房
        lock: async (id: number) => {
            return await request.get({url: '/yxt/roomlook/lock?id=' + id})
        },
        //关闭琴房
        close: async (id: number) => {
            return await request.get({url: '/yxt/roomlook/close?id=' + id})
        },
        // 远程开门
        remote: (id: number) => {
            return request.get({url: '/yxt/roomlook/remote?id=' + id})
        },
    }
}

//课程数据一览
export function useCourseApi() {
    return {
        //人员专业数据
        getMajorLook: async (data: any) => {
            return await request.post({url: '/yxt/memberLook/getMajorLook', data})
        },
        //人员课程统计
        getCourseLook: async (data: any) => {
            return await request.post({url: '/yxt/memberLook/getCourseLook', data})
        },
        //人员列表
        getMemberList: async (data: any) => {
            return await request.post({url: '/yxt/memberLook/getMemberList', data})
        },
        getMajorList: async () => {
            return await request.get({url: '/yxt/memberLook/majorList'})
        }
    }
}
